<template>
  <el-dialog
    :visible.sync="visible"
    width="630px"
    :close-on-click-modal="false"
    @close="$emit('close')"
  >
    <!-- 使用slot自定义弹窗标题 -->
    <template slot="title">
      <div class="dialog-header-content">
        <img
          style="max-height: 17px; margin-right: 10px"
          src="@/assets/template/dialog-title.png"
          alt=""
        />
        <span class="dialog-title-text">金额支付</span>
      </div>
    </template>
    <div class="modal-body">
      <div class="payment-info-section">
        <!-- 金额显示区域 - 调整为与图片一致的布局 -->
        <div class="payment-amount-box">
          <div class="amount-text">
            <span class="amount-number">{{ finalPrice }}</span>
            <span class="amount-unit yuan">元</span>
            <span class="amount-unit">/3月</span>
          </div>
          <div class="amount-divider"></div>
          <div class="amount-desc">确认支付金额，完成支付！</div>
          <div class="amount-success">
           <img  style="max-height: 30px;" src="@/assets/template/sucess.png" alt="">
          </div>
        </div>
        <div>
          <img style="max-height: 40px;" src="@/assets/template/saomazhifu.png" alt="">
        </div>

        <!-- 扫码支付区域 -->
        <div class="qr-code-section">
          <!-- <div class="qr-code-label">扫码支付</div>
          <div class="qr-code-dots">........</div> -->
          <div class="qr-code-image">
            <img src="@/assets/qrcode_service.png" alt="支付二维码" />
          </div>
        </div>
      </div>

      <!-- 链接区域 -->
      <div class="links-section">
        <div class="link-item">公众号链接：</div>
        <div class="link-item">管理端链接：</div>
        <div class="login-tip">
          <i class="el-icon-info" style="color: #ff7d00; margin-right: 5px"></i>
          管理端的登录账号密码与您的微小猪登录账号密码相同，请直接使用！
        </div>
      </div>

      <!-- 付款按钮 - 移至内容区域底部 -->
      <div class="payment-button-container">
        <el-button class="payment-done-btn" @click="handlePaymentDone"
          >付款完成</el-button
        >
      </div>
    </div>
  </el-dialog>
</template>

<script>
export default {
  name: "PaymentModal",
  props: {
    visible: {
      type: Boolean,
      default: false,
    },
    finalPrice: {
      type: Number,
      default: 1599,
    },
  },
  data() {
    return {
    };
  },
  methods: {
    handlePaymentDone() {
      this.$emit("paymentDone");
    },
  },
};
</script>

<style scoped>
/* 注意：如果使用scoped，需要使用/deep/穿透 */
::v-deep .el-dialog {
  border-radius: 15px;
  overflow: hidden;
}
/* 使用slot自定义标题的样式 */
.dialog-header-content {
  display: flex;
  align-items: center;
  font-size: 18px;
  font-weight: bold;
  color: #333;
}

.dialog-title-icon {
  color: #ff7d00;
  margin-right: 8px;
  font-size: 14px;
}

.dialog-title-text {
  font-size: 18px;
  font-weight: bold;
  color: #333;
}


/* 支付弹窗样式调整 */
.modal-body {
  /* 内容样式保持不变 */
  padding: 20px 40px;
}

.payment-info-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

/* 金额框样式 - 调整为与图片一致 */
.payment-amount-box {
  border: 2px solid #ff7d00;
  border-radius: 8px;
  padding: 20px 30px;
  position: relative;
  background-color: #fff;
}

/* 金额文本样式 - 分离数字和单位 */
.amount-text {
  font-size: 28px;
  font-weight: bold;
  margin-bottom: 10px;
  text-align: center;
}

.amount-number {
  font-size: 36px;
  font-weight: bold;
  color: #ff7d00;
}
.amount-unit.yuan {
  color: #323232 !important;
  font-size: 17px !important;
}
.amount-unit {
  font-size: 18px;
  margin-left: 5px;
  color: #ff7d00;
}

.amount-divider {
  height: 1px;
  background-color: #e8e8e8;
  margin-bottom: 10px;
}

.amount-desc {
  font-size: 12px;
  color: #666;
  text-align: center;
  padding: 10px 20px 0px 20px;
}
.amount-success{
  position: absolute;
    right: -2px;
    bottom: -2px;
}

.amount-arrow {
  position: absolute;
  bottom: -12px;
  right: 30px;
  width: 24px;
  height: 24px;
  background-color: #ff7d00;
  transform: rotate(45deg);
  z-index: 1;
}

.amount-arrow::after {
  content: "✓";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  color: white;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(-45deg);
}

/* 扫码区域样式 */
.qr-code-section {
  text-align: center;
}

.qr-code-label {
  font-size: 14px;
  color: #666;
  margin-bottom: 10px;
}

.qr-code-dots {
  font-size: 12px;
  color: #999;
  margin-bottom: 15px;
}

.qr-code-image img {
  width: 150px;
  height: 150px;
  border: 1px solid #eee;
}

/* 链接区域样式 */
.links-section {
  margin-bottom: 30px;
  padding-top: 20px;
}

.link-item {
  font-size: 12px;
  color: #666;
  margin-bottom: 10px;
}

.login-tip {
  font-size: 12px;
  color: #ff7d00;
  margin-top: 20px;
  display: flex;
  align-items: flex-start;
}

/* 付款按钮容器 */
.payment-button-container {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

/* 付款按钮样式 */
.payment-done-btn {
  background-color: #ff7d00;
  color: #fff;
  border: none;
  padding: 12px 40px;
  border-radius: 4px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
  width: 160px;
}

.payment-done-btn:hover {
  background-color: #ff6a00;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(255, 125, 0, 0.3);
}

.payment-done-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(255, 125, 0, 0.3);
}

/* 响应式设计 - 弹窗部分 */
@media (max-width: 768px) {
  .payment-info-section {
    flex-direction: column;
    gap: 20px;
  }

  .qr-code-image img {
    width: 120px;
    height: 120px;
  }
}
</style>
